package com.designpatterns.singleton.lazy;

/**
 * @author Tinu 1810989@qq.com
 */
//懒汉式单例
//双重检查锁实现
public class LazyDoubleCheckSingleton {

    private LazyDoubleCheckSingleton() {}

    private static volatile LazyDoubleCheckSingleton lazyDoubleCheckSingleton ;

    public static synchronized LazyDoubleCheckSingleton getInstance() {
        if (lazyDoubleCheckSingleton == null) {
            synchronized (LazyDoubleCheckSingleton.class) {
                if (lazyDoubleCheckSingleton == null) {
                    lazyDoubleCheckSingleton = new LazyDoubleCheckSingleton();
                }
            }

        }
        return lazyDoubleCheckSingleton;
    }
}
